﻿using Emoney.UserTraining.Cache;
using Emoney.UserTraining.DAL;
using Emoney.UserTraining.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Emoney.UserTraining.BLL
{
   public class Web_TrainPlaceBLL
    {
       public List<Web_TrainPlace> GetList(string userName)
       {
           Web_TrainPlaceQuery query = new Web_TrainPlaceQuery();
           query.UserName = userName;
           Web_TrainPlaceDAL dal = new Web_TrainPlaceDAL();

           List<Web_TrainPlace> list = new List<Web_TrainPlace>();
           string key = "dmtrainlst_" + userName;
           News2CacheTools cache = new News2CacheTools();
           var obj = cache.Get<List<Web_TrainPlace>>(key);
           if (obj != null)
           {
               list = obj;
           }
           else
           {
               list = dal.GetList(query);
               cache.Add(key, obj, 0, 0, 20);
           }
           return list;
       }
    }
}
